package com.kaifamiao.month04.day13;

public class Demo05 {

    public static void main(String[] args) throws InterruptedException {

		try {
			checkAge(80);
			checkAge(520);
		} catch(Exception e) {
			e.printStackTrace(System.out);
		}
        System.out.println("结束");
    }


    /**
     * @param age 需要检查的年龄
     * @throws IllegalArgumentException 当 age < 0 or age > 120
     */
    public static void checkAge(int age) throws InterruptedException { // 声明会抛出的异常
        if(age < 0 || age > 120) {
            throw new InterruptedException("age 有问题 " + age); // 抛异常
        }
        System.out.println("true");
    }

}
